package com.tianchi.lexiang.background;

import com.tianchi.lexiang.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

public class WallpaperSetting extends Activity implements OnItemClickListener {
	
	private ListView backgroundSettingList;
	private Button backBtn;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.wallpaper_setting);
		initView();
	}

	private void initView() {
		backgroundSettingList = (ListView) findViewById(R.id.wallpaper_setting_list);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, this.getResources().getStringArray(R.array.wallpaper_setting));
		backgroundSettingList.setAdapter(adapter);
		backgroundSettingList.setOnItemClickListener(this);
		backBtn = (Button) findViewById(R.id.back_btn);
		backBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				WallpaperSetting.this.finish();
			}
		});
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
		Intent intent = new Intent();
		switch (position) {
		case 0:
			intent.setClass(WallpaperSetting.this, StaticWallpaperSetting.class);
			break;
		case 1:
			break;
		default:
			break;
		}
		WallpaperSetting.this.startActivity(intent);
	}

}
